﻿using DataServer.Entities;
using DataServer.Utils;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;

namespace IsPay.api
{
    /// <summary>
    /// batchpay 的摘要说明
    /// </summary>
    public class batchpay : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            if (context.Session["BatchPage"] != null)
            {
                var batchPage = (BatchPage)context.Session["BatchPage"];
                string jsonBatchPage = JsonConvert.SerializeObject(batchPage);

                context.Response.ContentType = "text/plain";
                context.Response.Write(jsonBatchPage);
            }
            else
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(MakeWebReturnCode.MakeCode(Constants.WebRetNotSession));
            }            
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}